<!DOCTYPE html>
<html lang="cn">
	<head>
		<meta charset="utf-8">
		<title>网站后台管理</title>
	</head>
	<body>
		<script type="text/javascript">
			$(function() {
				$('#upload').click(function() {
					var json_obj = {
							username: $('#username').val(),
							password: $('#password').val(),
							datas: [
							        {
								        game_id: $('#datas1').val(),
								        level: $('#level1').val()
							        },
							        {
								        game_id: $('#datas2').val(),
								        level: $('#level2').val()
							        }
								   ]
							};    //JSON对象   

					var json_str = JSON.stringify(json_obj);    //将JSON对象转变成JSON格式的字符串
				    $.post("/get", json_str, callback, "json");
				})

				function callback(json){
					$('#response').html('code:'+json['status']['code'] + "\tmessage:" + json['status']['message']);
				}
			})
		</script>

		<h1>测试json格式数据提交</h1>
		<form action="{% url 'get' %}" method="POST">
			{% csrf_token %}
			<button onclick="callback()">提交</button>
		</form>
	</body>
</html>